package org.example.Command;

import lombok.Data;
import org.example.Exceptions.WrongArgsException;

import java.util.HashMap;

@Data
public class RecvMessage extends Command {

    private String key;

    @Override
    public void check() throws Exception {
        String key = args.get("-m");
        if (key == null) throw new WrongArgsException("-m", "缺少一个key");
        this.key = key;
    }


    public RecvMessage(String commandStr, HashMap<String, String> args, String key) {
        super(commandStr, args, RECV_COMMAND);
        this.key = key;
    }

    public RecvMessage(String commandStr, HashMap<String, String> args) {
        super(commandStr, args, 2);
    }
}
